package com.google.gwt.it2tool.client.widget;

import java.util.ArrayList;

import com.google.gwt.it2tool.client.Factory;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class FactoryDetailsPanel extends VerticalPanel{
	
	private final Factory factory;
	
	private final HorizontalPanel topPanel = new HorizontalPanel();
	private final VerticalPanel leftPanel = new VerticalPanel();
	private final VerticalPanel rightPanel = new VerticalPanel();
	
	private final FactoryFlexTable prodsTable;

	private final DisclosurePanel ressourceSummaryPanel = new DisclosurePanel("Ressourcenbedarf");
	private final RessourceNeedsFlexTable ressouceFlexTable = new RessourceNeedsFlexTable();
	
	private final HorizontalPanel bottomPanel = new HorizontalPanel();
	private final DisclosurePanel stockPanel = new DisclosurePanel("Lager");
	
	public FactoryDetailsPanel(Factory fac){
		super();
		factory = fac;
		prodsTable = new FactoryFlexTable(fac);
		
		leftPanel.add(prodsTable);
		
		ArrayList<Factory> data = new ArrayList<Factory>();
		data.add(fac);
		ressouceFlexTable.setData(data);
		ressourceSummaryPanel.add(ressouceFlexTable);
		ressourceSummaryPanel.addStyleName("ressourceSummaryPanel");
		ressourceSummaryPanel.setAnimationEnabled(true);
		ressourceSummaryPanel.setOpen(true);
		
		rightPanel.add(ressourceSummaryPanel);
		rightPanel.addStyleName("factoryDetailLeftPanel");
		
		topPanel.add(leftPanel);
		topPanel.add(rightPanel);
		
		stockPanel.setOpen(true);
		
		bottomPanel.add(stockPanel);
		bottomPanel.addStyleName("stockDisclosurePanel");
		
		this.add(topPanel);
		this.add(bottomPanel);
		
	}

}
